import { Tools } from 'weaver-mobile';
import { catchApiError } from '../util/index';

// 新建群投票
export const groupvoteaddcondition = params => {
	let options = {
		method: 'GET',
		url: '/api/groupchatvote/condition/groupvoteaddcondition',
		params: params
	};
	return Tools.callApi(options).then(catchApiError);
}

// 新建群投票--option
export const groupvoteoptioncondition = params => {
	let options = {
		method: 'GET',
		url: '/api/groupchatvote/condition/groupvoteoptioncondition',
		params: params
	};
	return Tools.callApi(options).then(catchApiError);
}

// 新建群投票--发布
export const groupchatvoteadd = params => {
	let options = {
		method: 'POST',
		url: '/api/groupchatvote/base/groupchatvoteadd',
		params: params
	};
	return Tools.callApi(options).then(catchApiError);
}

// 群投票列表
export const getGroupVoteList = params => {
	let options = {
		method: 'GET',
		url: '/api/groupchatvote/list/getGroupVoteList',
		params: params
	};
	return Tools.callApi(options).then(catchApiError);
}

// 删除群投票
export const groupchatvotedel = params => {
	let options = {
		method: 'POST',
		url: '/api/groupchatvote/base/groupchatvotedel',
		params: params
	};
	return Tools.callApi(options).then(catchApiError);
}

// 批量分享
export const groupchatvotealert = params => {
	let options = {
		method: 'POST',
		url: '/api/groupchatvote/base/groupchatvoteshare',
		params: params
	};
	return Tools.callApi(options).then(catchApiError);
}

// 详情查看
export const viewGroupVote = params => {
	let options = {
		method: 'GET',
		url: '/api/groupchatvote/base/groupchatvotealert',
		params: params
	};
	return Tools.callApi(options).then(catchApiError);
}

// 投票
export const savegroupvoteresult = params => {
	let options = {
		method: 'POST',
		url: '/api/groupchatvote/base/savegroupvoteresult',
		params: params
	};
	return Tools.callApi(options).then(catchApiError);
}

// 投票-参与人
export const groupchatvoteprelist = params => {
	let options = {
		method: 'GET',
		url: '/api/groupchatvote/list/groupchatvoteprelist',
		params: params
	};
	return Tools.callApi(options).then(catchApiError);
}